package per.dg.keepalive

import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import per.dg.keepalive.multiprocess.aidl.GuardProcessAidlActivity
import per.dg.keepalive.onepixel.ScreenBroadcastListener
import per.dg.keepalive.onepixel.ScreenManager

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        var screenManager : ScreenManager = ScreenManager.getInstance(this);
        var listener : ScreenBroadcastListener = ScreenBroadcastListener(this);
        listener.registerListener(object : ScreenBroadcastListener.ScreenStateListener {
            override fun onScreenOn() {
                screenManager.finishActivity();
            }

            override fun onScreenOff() {
                screenManager.startActivity();
            }
        });
    }

    fun onClick(view: View) {

//        startService(Intent(this, KeepLiveService::class.java))
//        bindService(Intent(this, MultiProcessService::class.java), serviceConnection, Service.BIND_AUTO_CREATE)
//        startActivity(Intent(this, MessengerClientActivity::class.java))
        startActivity(Intent(this, GuardProcessAidlActivity::class.java))

    }
}